﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Show1
{
    public partial class FrmAdd : Form
    {
        public FrmAdd()
        {
            InitializeComponent();
        }

        //保存按钮
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtNo.Text.Length == 0)
            {
                MessageBox.Show("请填写学号");
                return;
            }


            string bornDate= dtpBorn.Value.ToString("yyyy-MM-dd");

            //string sex;//性别
            //if (rbtnNan.Checked)
            //{
            //    sex = "男";
            //}
            //else
            //{
            //    sex = "女";
            //}
            string sex = rbtnNan.Checked ? "男" : "女";

            string email = txtEmail.Text.Length == 0 ? "null" : "'" + txtEmail.Text + "'";

            string sql = string.Format("insert into Student values('{0}','{1}','{2}','{3}',{4},'{5}','{6}','{7}',{8});",
                txtNo.Text,
                txtPwd.Text,txtName.Text,
                sex,txtGradeID.Text,
                txtPhone.Text,
                txtAddress.Text,
                bornDate,
                email);

            
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            txtNo.Text = 
            txtName.Text =
            txtEmail.Text=
            txtPhone.Text=
            txtPwd.Text=
            txtPwd2.Text=
            txtGradeID.Text=
            txtAddress.Text = "";
            rbtnNan.Checked = true;

        }

        

    }
}
